package com.yedean.mall.token;

import lombok.Data;

import java.util.Date;

/**
 * TokenGroup
 *
 * @author yedean
 * @date 2022/8/17
 */
@Data
public class TokenGroup {

    /**
     * 刷新token（长token）
     */
    private String refreshToken;

    /**
     * 访问token（短token）
     */
    private String accessToken;

    /**
     * access token过期时刻
     */
    private Long accessExpireIn;

    /**
     * refresh token过期时刻
     */
    private Long refreshExpireIn;


    public TokenGroup(AccessTokenEntity accessTokenEntity, RefreshTokenEntity refreshTokenEntity) {
        this.accessToken = accessTokenEntity.getAccessToken();
        this.accessExpireIn = accessTokenEntity.getExpireIn().getTime();
        this.refreshToken = refreshTokenEntity.getRefreshToken();
        this.refreshExpireIn = refreshTokenEntity.getExpireIn().getTime();
    }
}
